package com.enterprise.struts2.recruit;

import com.enterprise.daoImpl.RecruitDaoImpl;
import com.enterprise.domain.Recruit;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class RecruitAction extends ActionSupport implements ModelDriven<Recruit> {

	/**
	 * 
	 */
	
	private Recruit recruit=new Recruit();
	RecruitDaoImpl recruitDaoImpl=new RecruitDaoImpl();
	public Recruit getRecruit() {
		return recruit;
	}

	public void setRecruit(Recruit recruit) {
		this.recruit = recruit;
	}

	@Override
	public Recruit getModel() {
		// TODO Auto-generated method stub
		return recruit;
	}
	
	public String add(){
		if(recruitDaoImpl.addRecruit(recruit)>0){
			return "success";
		}else{
			return "input";
		}
	}
	
	public String delete(){
		if(recruitDaoImpl.deleteRecruit(recruit)>0){
			return "success";
		}else{
			return "input";
		}
	}
	
	public String update(){
		if(recruitDaoImpl.updateRecruit(recruit)>0){
			return "success";
		}else{
			return "input";
		}
	}
	
	

}
